package com.salon.modules.makeup.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.salon.common.http.response.PageResult;
import com.salon.modules.makeup.mapper.ReservationMapper;
import com.salon.modules.makeup.entity.ReservationEntity;
import com.salon.modules.makeup.service.ReservationService;
import com.salon.common.utils.Query;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;

import java.util.Map;

/**
 * 服务预约
 *
 * @author lch 12345678@qq.com
 * @since 1.0.0 2023-10-10
 */
@Service
public class ReservationServiceImpl extends ServiceImpl<ReservationMapper, ReservationEntity> implements ReservationService {

    @Override
    public PageResult<ReservationEntity> listReservationByPage(Map<String, Object> params) {
        IPage<ReservationEntity> page = new Query<ReservationEntity>().getPage(params);
        IPage<ReservationEntity> list = baseMapper.listReservationByPage(page, params);
        return new PageResult<>(list.getTotal(), list.getCurrent(), list.getSize(), list.getRecords());
    }

    @Override
    public ReservationEntity getReservationById(Integer id) {
        return baseMapper.getReservationById(id);
    }

    @Override
    public PageResult<ReservationEntity> listMyReservationPage(Map<String, Object> params) {
        IPage<ReservationEntity> page = new Query<ReservationEntity>().getPage(params);
        IPage<ReservationEntity> list = baseMapper.listMyReservationPage(page, params);
        return new PageResult<>(list.getTotal(), list.getCurrent(), list.getSize(), list.getRecords());
    }

}